package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.entity.activity.foxcard.UserFoxCardGameData;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;
import java.util.List;

/**
 * 每场战斗的第一次弃牌，如果只弃掉x张牌，则摧毁这些牌并加效果
 */
public class FoxCardEffect47 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType != eFoxCardTriggerType.DROP) {
            return;
        }
        UserFoxCardGameData gameData = gameLogic.getGameData();
        boolean isFirstDrop = (gameData.getDropCardTimesMax() - gameData.getDropCardTimes()) == 1;
        if (!isFirstDrop) {
            return;
        }
        int dropNum = gameLogic.getDropHandCards().size();
        if (dropNum != Integer.valueOf(effectConfig.getParamsList().get(0))) {
            return;
        }
        List<FoxBaseCard> foxEffectCards = Collections.singletonList(effectCard);
        gameLogic.addBaseScore(Integer.valueOf(effectConfig.getParamsList().get(1)), foxEffectCards, null); //加基础筹码
        gameLogic.addBaseScoreMulti(Integer.valueOf(effectConfig.getParamsList().get(2)), foxEffectCards, null); //当前基础筹码乘算
        gameLogic.addBaseMulti(Integer.valueOf(effectConfig.getParamsList().get(3)), foxEffectCards, null); //加基础倍率
        gameLogic.addBaseMultiMulti(Integer.valueOf(effectConfig.getParamsList().get(4)), foxEffectCards, null); //当前基础倍率乘算
        gameLogic.goldChange(Integer.valueOf(effectConfig.getParamsList().get(5)), foxEffectCards, null, triggerType); //加金币

        gameLogic.destroyHandCards(gameLogic.getDropHandCards());

    }


}
